package edu.ntu.im.p2ptrade.msg.handle;

import edu.ntu.im.p2ptrade.OwnerManager;
import edu.ntu.im.p2ptrade.P2PTrade;
import edu.ntu.im.p2ptrade.Util;
import edu.ntu.im.p2ptrade.msg.PMessage;
import edu.ntu.im.p2ptrade.msg.UserInfo;
import net.jxta.endpoint.Message;

public class QueryUserHandle implements PMessageHandle {

	public void handle(Message msg) {
		String peer = msg.getMessageElement(P2PTrade.getInstance().getAppName(), PMessage.PEER).toString();
		UserInfo userInfo = new UserInfo(OwnerManager.getOwner());
		try {
			Util.transdferMessageToPeer(userInfo.getMessageToTransfer(), peer);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
